Photographing method, photographing device, storage medium and electronic device

ABSTRACT

A photographing method includes: performing a key point detection on a human body in a photographing scene to obtain a human body key point set of the human body; determining a composition key point set corresponding to the photographing scene; in response to the human body key point set not matching the composition key point set, generating and outputting a prompt message to adjust an attitude of the electronic device; and in response to the human body key point set matching the composition key point set, performing a photographing operation on the photographing scene to obtain a target image.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation of International Application No.PCT/CN2020/142422, filed on Dec. 31, 2020, which claims priority toChinese Application No. 202010075364.1, filed on Jan. 22, 2020, both ofwhich are incorporated herein by reference in their entireties.

FIELD OF THE DISCLOSURE

The present disclosure relates to an electronic technique, and moreparticularly, to a photographing method, a photographing device, astorage medium and an electronic device.

BACKGROUND

As the progress of the development of the electronic device, thedefinition of the camera in the electronic device, such as a smartphone, becomes higher. Therefore, more and more users tend to use theelectronic device, such as a smart phone, to take pictures. In order tomeet this demand, the device providers upgrade the hardware of theelectronic device to further increase the definition of the electronicdevice. However, in order to obtain a high quality picture, not only thecamera with a higher definition is required, but also the user needs tohave a certain level of photographing skills, such as have skills ofusing reasonable composition of a picture.

SUMMARY

One objective of an embodiment of the present disclosure is to provide aphotographing method, a photographing device, a storage medium and anelectronic device to raise the image quality.

According to an embodiment of the present disclosure, a photographingmethod used in an electronic device is disclosed. The photographingmethod comprises: performing a key point detection on a human body in aphotographing scene to obtain a human body key point set of the humanbody; determining a composition key point set corresponding to thephotographing scene; upon a condition that the human body key point setdoes not match the composition key point set, generating and outputtinga prompt message to adjust an attitude of the electronic device; andupon a condition that the human body key point set matches thecomposition key point set, performing a photographing operation on thephotographing scene to obtain a target image.

According to an embodiment of the present disclosure, a photographingdevice, used in an electronic device, is disclosed. The photographingdevice comprises: a detecting module, configured to perform a key pointdetection on a human body in a photographing scene to obtain a humanbody key point set of the human body; a determining module, configuredto determine a composition key point set corresponding to thephotographing scene; a generating module, configured to generate andoutput a prompt message to adjust an attitude of the electronic deviceupon a condition that the human body key point set does not match thecomposition key point set; and a photographing module, configured toperform a photographing operation on the photographing scene to obtain atarget image upon a condition that the human body key point set matchesthe composition key point set.

According to an embodiment of the present disclosure, a storage mediumis disclosed. The storage medium stores a computer program. The computerprogram is configured to be executed by a computer to perform theabove-mentioned photographing method.

According to an embodiment of the present disclosure, an electronicdevice is disclosed. The electronic device comprises: a processor; and astorage device, storing a computer program; wherein the processor isconfigured to execute the computer program stored in the storage deviceto perform the above-mentioned photographing method.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and/or additional aspects and advantages of the presentapplication become apparent and readily understood from the followingdescription of embodiments taken in conjunction with the accompanyingdrawings,

FIG. 1 is a flow chart of a photographing method according to oneembodiment of the present disclosure.

FIG. 2 is a flow chart of a photographing method according to anotherembodiment of the present disclosure.

FIG. 3 is a diagram of a preview image G1 according to anotherembodiment of the present disclosure.

FIG. 4 is a diagram of a human body boundary frame B1 according to anembodiment of the present disclosure.

FIG. 5 is a diagram of a human body image G2 according to an embodimentof the present disclosure.

FIG. 6 is a diagram of a prompt message according to an embodiment ofthe present disclosure.

FIG. 7 is a diagram of a target image G3 according to an embodiment ofthe present disclosure.

FIG. 8 is a diagram of a photographing device according to an embodimentof the present disclosure.

FIG. 9 is a diagram of an electronic device according to an embodimentof the present disclosure.

FIG. 10 is a diagram of an electronic device according to an embodimentof the present disclosure.

FIG. 11 is a diagram of an image processing circuit according to anembodiment of the present disclosure.

DETAILED DESCRIPTION

Please refer to the drawings, where the same component symbols representthe same components, and the principles of the present disclosure areexemplified by being implemented in a suitable computing environment.The terminologies in the embodiments of the present disclosure aremerely for describing the purpose of the certain embodiment, but not tolimit the disclosure. Examples and the appended claims be implemented inthe present disclosure requires the use of the singular form of the book“an”, “the” and “the” are intended to include most forms unless thecontext clearly dictates otherwise.

According to one embodiment of the present disclosure, a photographingmethod used in an electronic device comprises:

-   -   performing a key point detection on a human body in a        photographing scene to obtain a human body key point set of the        human body;    -   determining a composition key point set corresponding to the        photographing scene; in response to the human body key point set        not matching the composition key point set, generating and        outputting a prompt message to adjust an attitude of the        electronic device;    -   in response to the human body key point set matching the        composition key point set, performing a photographing operation        on the photographing scene to obtain a target image.

Optionally, the step of performing the key point detection on the humanbody in the photographing scene to obtain the key point set of the humanbody comprises:

-   -   obtaining a preview image of the photographing scene; utilizing        a portrait detection model to perform a portrait detection on        the preview image to obtain a human body boundary frame;    -   cutting the preview image based on the human body boundary frame        to obtain a human body image; and    -   utilizing a key point detection model to perform the key point        detection on the human body image to obtain the human body key        point set of the human body.

Optionally, the step of determining the composition key point setcorresponding to the photographing scene comprises:

-   -   dividing the preview image into a foreground image and a        background image;    -   determining a plurality of candidate key point sets        corresponding to the background image;    -   determining a human body type of the human body; and    -   determining, from the plurality of candidate key point sets, at        least one of candidate key point sets that is corresponding to        the human body type as the composition key point set        corresponding to the photographing scene.

Optionally, the photographing method further comprises:

-   -   in response to multiple of the candidate key point sets        correspond to the human body type, obtaining a composition        boundary frame according to each of the multiple of candidate        key point sets corresponding to the human body type; and    -   determining at least one of the multiple of candidate key point        sets, where the composition boundary frame corresponding to the        at least one of the multiple of candidate key point matches the        human body boundary frame, as the composite key point set        corresponding to the photographing scene.

Optionally, after the step of determining the composition key point setcorresponding to the photographing scene, the photographing methodfurther comprises:

-   -   measuring distances between each human body key point and its        corresponding composition key point; and    -   calculating an average distance of the distances.

The human body key point set not matching the composition key point setcomprises: the average distance being greater than or equal to apredetermined average distance.

Optionally, the step of generating and outputting the prompt message toadjust the attitude of the electronic device comprises:

-   -   generating a plurality of candidate vectors;    -   predicting a target human body key point set obtained after        adjusting the attitude of the electronic device according to        each of the candidate vectors;    -   determining a candidate vector of the plurality of candidate        vectors as a target vector, where the target human body key        point set corresponding to the candidate vector matches the        composition key point set; and    -   generating and outputting the prompt message to adjust the        attitude of the electronic device according to the target        vector.

Optionally, after the step of determining the composition key point setcorresponding to the photographing scene, the photographing methodfurther comprises:

-   -   determining a human face key point set from the human body key        point set;    -   obtaining a horizontal coordinate of each human face key point        to obtain a plurality of first horizontal coordinates;    -   calculating a first average value of the plurality of first        horizontal coordinates; and    -   in response to the first average value being within a        predetermined range, determining a target composition key point        set corresponding to the human face key point set from the        composition key point set.

The human body key point set not matching the composition key point setcomprises: the human face key point set not matching the targetcomposition key point set.

Optionally, after the step of determining the target composition keypoint set corresponding to the human face key point set from thecomposition key point set, the photographing method further comprises:

-   -   obtaining a vertical coordinate of each human key point to        obtain a plurality of first vertical coordinates and obtaining a        horizontal coordinate and a vertical coordinate of each target        composition key point to obtain a plurality of first vertical        coordinates and a plurality of second horizontal coordinates;    -   calculating a second average value of the plurality of first        vertical coordinates, a third average value of the plurality of        first vertical coordinates and a fourth average value of the        plurality of second horizontal coordinates;    -   determining a first target coordinate according to the first        average value and the second average value and determining a        second target coordinate according to the third average value        and the fourth average value; and    -   calculating a first distance between the first target coordinate        and the second target coordinate.

The human body key point set not matching the composition key point setcomprises: the first distance being greater than or equal to a firstpredetermined distance.

Optionally, after the step of calculating the first average value of theplurality of horizontal coordinates, the photographing method furthercomprises:

-   -   in response to the first average not within the predetermined        range, detecting whether the human body key point set has a        predetermined key point;    -   in response to the human body key point set not having a        predetermined key point, obtaining a first center coordinate of        the human body boundary frame and a second center coordinate of        the composition boundary frame corresponding to the composition        key point set;    -   calculating a second distance between the first center        coordinate and the second center coordinate.

The human body key point set not matching the composition key point setcomprises:

-   -   the second distance being greater than or equal to a second        predetermined distance.

Optionally, after the step of detecting whether the human body key pointset has the predetermined key point, the photographing method furthercomprises:

-   -   in response to the human key point set having the predetermined        key point, obtaining a first center horizontal coordinate of the        human body boundary frame and a second center horizontal        coordinate of the composition boundary frame corresponding to        the composition key point set;    -   determining a target composition key point set corresponding to        the human face key point set from the composition key point set;    -   obtaining a vertical coordinate of each human face key point to        obtain a plurality of third vertical coordinates and obtaining a        vertical coordinate of each composition key point to obtain a        plurality of fourth vertical coordinates;    -   calculating a fifth average value of the plurality of third        vertical coordinates and a sixth average value of the plurality        of fourth vertical coordinates;    -   determining a third target coordinate according to the first        center horizontal coordinate and the fifth average value and        determining a fourth target coordinate according to the second        center horizontal coordinate and the sixth average value;    -   calculating a third distance between the third target coordinate        and the fourth target coordinate.

The human body key point set not matching the composition key point setcomprises: the third distance being greater than or equal to a thirdpredetermined distance.

It can be understood that, the embodiments of the present disclosure maybe performed by an electronic device such as a smart phone or a tabletcomputer.

Please refer to FIG. 1. FIG. 1 is a flow chart of a photographing methodaccording to a first embodiment of the present disclosure. Thephotographing method comprises blocks 101-104.

Block 101: performing a key point detection on a human body in aphotographing scene to obtain a human body key point set of the humanbody.

For example, the electronic device could obtain a preview image of thephotographing scene. And then, the electronic device could determine ahuman body boundary frame from the preview image. And then, theelectronic device could cut the preview image to generate a human bodyimage based on the human body boundary frame. At last, the electronicdevice could perform the key point detection on the human body image toobtain the human body key point set of the human body in thephotographing scene. Here, the human body key point set could compriseone or more human body key points, including a nose, a left eye, a righteye, a left ear, a right ear, a neck, a left shoulder, a right shoulder,a left elbow, a right elbow, a left wrist, a right wrist, a leftbuttock, a right buttock, a left knee, a right knee, a left ankle and aright ankle.

Here, after the electronic device activates a photographing applicationbased on the user's operation (such as an application “camera” in theelectronic device), the scene that camera is aiming is the photographingscene. For example, the user uses his finger to click the icon of the“camera” application on the screen of the electronic device. Then, theuser uses the camera of the electronic device to aim a certain scene,the scene is the photographing scene. From the above, a person havingordinary skills in the art could understand that the photographing scenedoes not mean a specific scene. Instead, the photographing scenerepresents a scene that the camera is currently aiming.

Block 102: determining a composition key point set corresponding to thephotographing scene.

For example, the electronic device could have different candidate keypoint sets with reasonable compositions. The candidate key point setcould correspond to the background image. Here, one background imagecould correspond to multiple candidate key point sets. Each candidatekey point set could comprise one or more candidate body key points,including a nose, a left eye, a right eye, a left ear, a right ear, aneck, a left shoulder, a right shoulder, a left elbow, a right elbow, aleft wrist, a right wrist, a left buttock, a right buttock, a left knee,a right knee, a left ankle and a right ankle.

In an embodiment, the electronic device could divide the preview imageof the photographing scene into a foreground image and a backgroundimage. And then, the electronic device could obtain a plurality ofcandidate key point sets corresponding to the background image anddetermine one of the plurality of candidate key point sets as thecomposition key point set corresponding to the photographing scene.

Here, the foreground image could be an image having a “human”, a “cat”,or a “dog”. The background image could be an image including a“mountain” view, a “water” view, an “ocean” view, or a “snow” view.

For example, the composition key point set corresponding to thephotographing scene could be a candidate key point set identical to orsimilar to the human body key point set in the plurality of candidatekey point sets corresponding to the background image. For instance,assume that the human body key point set comprises 8 key pointsincluding a nose, a left eye, a right eye, a left ear, a right ear, aneck, a left shoulder, and a right shoulder. If the multiple candidatekey point sets corresponding to the background image of thephotographing scene has a candidate key point set, which includes onlythe 8 key points of a nose, a left eye, a right eye, a left ear, a rightear, a neck, a left shoulder, and a right shoulder, then the electroniccould determine that the candidate key point set is identical to thehuman body key point set and thus determine the candidate key point setas the composition key point set corresponding to the photographingscene. If multiple candidate key point sets all have a candidate keypoint set, which includes not only 8 key points of a nose, a left eye, aright eye, a left ear, a right ear, a neck, a left shoulder and a rightshoulder but also other key points such as a left elbow and a rightelbow, then the electronic device could determine that the candidate keypoint set is similar to the human body key point set and thus coulddetermine the candidate key point set as the composition key point setcorresponding to the photographing scene.

Block 103: upon a condition that the human body key point set does notmatch the composition key point set, generating and outputting a promptmessage to adjust an attitude of the electronic device.

For example, after obtaining the human body key point set and thecomposition key point set, the electronic device could determine whetherthe human body key point set matches the composition key point set.Under the condition that the human body key point set does not match thecomposition key point set, the electronic device generates and outputs aprompt message to adjust an attitude of the electronic device such thatthe current human body key point set of the human body matches thecomposition key point set.

As the change of the attitude of the electronic device, thephotographing scene changes accordingly. As the change of thephotographing scene, the key point detection is performed on the humanbody in the photographing scene and the positions of the human body keypoints in the human body key point set change. The changing human bodykey points, having changing positions, are the current human body keypoints and the key point set including these changing human body keypoints is the current human body key point set.

For example, when determining whether the human body key point setmatches the composition key point set, the electronic device couldmeasure the distances between each human body key point and itscorresponding composition key point. And then, the electronic devicecould calculate an average distance of the distances. Upon a conditionthat the average distance is greater than or equal to a predeterminedaverage distance, the electronic device determines that the human bodykey point set does not match the composition key point set. Here, upon acondition that the human body key point is a nose, its corresponding keypoint is also a nose. Upon a condition that the human body key point isa left shoulder its corresponding key point is also a left shoulder.

Furthermore, when determining whether the human body key point setmatches the composition key point set, the electronic device coulddetermine the human face key point set from the human body key point setand determine a target composition key point set corresponding to thehuman key point set from the composition key point set. Upon a conditionthat the human face does not match the target composition key point set,the electronic device could determine that the human body key point setdoes not match the composition key pint set.

In addition, when determining whether the human body key point setmatches the composition key point set, the electronic device coulddetermine an average value A1 of horizontal coordinates and an averagevalue A2 of vertical coordinates of a plurality of human body key pointsincluded in the human body key point set and determine an average valueA3 of horizontal coordinates and an average value A4 of verticalcoordinates of a plurality of composition body key points included inthe composition key point set. Then, the electronic device coulddetermine a first coordinate according to the average value A1 and theaverage value A2. Here, the average value A1 could be the horizontalcoordinate of the first coordinate and the average value A2 could be thevertical coordinate of the first coordinate. In addition, the electronicdevice could determine a second coordinate according to the averagevalue A3 and the average value A4. Here, the average value A3 could bethe horizontal coordinate of the second coordinate and the average valueA4 could be the vertical coordinate of the second coordinate. And then,the electronic device could calculate the distance between the firstcoordinate and the second coordinate. Upon a condition that the distancebetween the first coordinate and the second coordinate is greater thanor equal to a predetermined distance, the electronic device coulddetermine that the human body key point set does not match thecomposition key point set. In this embodiment, the horizontalcoordinates and the vertical coordinates of the human body key points,the horizontal coordinates and the vertical coordinates of thecomposition key points, the first coordinate and the second coordinateare all coordinates in the screen coordinate system.

Block 104: upon a condition that the human body key point set matchesthe composition key point set, performing a photographing operation onthe photographing scene to obtain a target image.

In an embodiment, under the condition that the current human body keypoint set matches the composition key point set, the electronic devicecould perform a photographing operation on the photographing scene toobtain an image, which meets certain aesthetical rules and has areasonable composition. Or, under the condition that the current humanbody key point set matches the composition key point set, the electronicdevice could generate a prompt message to remind the user to take apicture of the photographing scene. Accordingly, the user could clickthe “shot” button in the camera application to take a picture of thephotographing scene to obtain a target image that meets certainaesthetical rules.

It could be understood that the electronic device could directly take apicture of the photographing scene to obtain a target image that meetscertain aesthetical rules and has a reasonable composition if the humanbody key point set matches the composition key point set.

In this embodiment, through obtaining the human body key point set ofthe human body in the photographing scene and determining thecomposition key point set having a reasonable composition andcorresponding to the photographing scene, the preview imagecorresponding to the photographing scene could be ensured to have areasonable composition when the human body key point set matches thecomposition key point set. When the human body key point set does notmatch the composition key point set, a prompt message is to adjust anattitude of the electronic device is generated and outputted such thatthe current preview image of the photographing scene could become tohave a reasonable composition. In this way, an image having a reasonablecomposition could be obtained and thus the image quality could beraised.

In one embodiment, the step of “performing a key point detection on ahuman body in a photographing scene to obtain a human body key point setof the human body” comprises:

-   -   (1) obtaining a preview image of the photographing scene;    -   (2) utilizing a portrait detection model to perform a portrait        detection on the preview image to obtain a human body boundary        frame;    -   (3) cutting the preview image based on the human body boundary        frame to obtain a human body image;    -   (4) utilizing a key point detection model to perform the human        body key point detection on the human body image to obtain the        key point set of the human body.

For example, the electronic device could obtain a preview image of thephotographing scene and identify the item in the preview image todetermine whether the preview image has a human body. Upon a conditionthat the preview image has a human body, the electronic device couldutilize a predetermined portrait detection model to perform a portraitdetection on the preview image to obtain a human body boundary frame.The electronic device could cut the preview image based on the humanbody boundary frame to obtain a human body image. The electronic devicecould utilize a predetermined key point detection model to perform thekey point detection on the human body image to obtain the human body keypoint set of the human body in the preview image.

Upon a condition that the preview image does not have a human body orhave multiple human bodies, the electronic device could finish the flow.

In an embodiment, the step of “determining the composition key point setcorresponding to the photographing scene” comprises:

-   -   (1) dividing the preview image into a foreground image and a        background image;    -   (2) determining a plurality of candidate key point sets        corresponding to the background image;    -   (3) determining a human body type of the human body;    -   (4) determining at least one of the plurality of candidate key        point sets that is corresponding to the human body type as the        composition key point set corresponding to the photographing        scene.

For example, the electronic device could utilize a predetermined sceneidentification model to perform a scene identification on the previewimage to obtain a scene identification result. The electronic devicecould divide the preview image into a foreground image and a backgroundimage according to the scene identification result. The sceneidentification result could comprise a foreground tag and a backgroundtag of an image. The electronic device could divide the preview imageinto the foreground image and the background image according to theforeground tag and the background tag.

Here, the foreground tag is used to describe an item that is in anapparent position of the preview image and could be labeled by arectangular frame. The background tag is used to describe an overallinformation of the preview image. For example, the background tag couldbe “mountain view”, “water view”, “snow view” or “rain view”. Theforeground tag could be “human”, “cat” or “dog”. For example, for apreview image showing a person standing beside a lake, the foregroundtag could be “human” and the background tag could be “water view.”Accordingly, the foreground image could be an image having a “human”image and the background image could be a “water view” image.

It should be noted that the electronic device could pre-store aplurality of predetermined background images and have a plurality ofcandidate key point sets corresponding to the predetermined backgroundimages. Here, the predetermined background images could include a “waterview” image, a “mountain view” image, a “snow view” image, etc. Eachcandidate key point set could comprise one or more candidate key points,including a nose, a left eye, a right eye, a left ear, a right ear, aneck, a left shoulder, a right shoulder, a left elbow, a right elbow, aleft wrist, a right wrist, a left buttock, a right buttock, a left knee,a right knee, a left ankle and a right ankle.

After dividing the preview image into the foreground image and thebackground image, the electronic device could obtain a plurality ofpreview background images. And then, the electronic device coulddetermine whether the plurality of preview background images have onepreview background image matching the background image. Here, assumethat the background image is a “water view” image and the previewbackground images also have one “water view” image. In this case, theelectronic device could determine that the plurality of previewbackground images have at least one preview background image matchingthe background image. When determining that the plurality of previewbackground images have at least one preview background image matchingthe background image, the electronic device could obtain multiplecandidate key point sets corresponding to the predetermined backgroundimage matching the background image and take them as the multiplecandidate key point sets corresponding to the background image. Andthen, the electronic device could determine the human body type of thehuman body in the photographing scene. And then, the electronic devicecould determine at least one candidate key point set corresponding tothe human body type from the plurality of candidate key point sets asthe composition key point set corresponding to the photographing scene.

It could be understood that when the electronic device sets a differentcandidate key point set for each predetermined background image, theelectronic device could further set a type for each candidate key pointset corresponding to each preview background image. For example, if acertain candidate key point set comprises key points higher than thehuman chest, including a nose, a left eye, a right eye, a left ear, aright ear, a neck, a left shoulder, and a right shoulder, the electronicdevice could determine that the type of the candidate key point set is abust type. If a certain candidate key point set comprises key points ofthe entire human body, including a nose, a left eye, a right eye, a leftear, a right ear, a neck, a left shoulder, a right shoulder, a leftelbow, a right elbow, a left wrist, a right wrist, a left butt, a rightbutt, a left knee, a right knee, a left ankle and a right ankle, theelectronic device could determine that the type of the candidate keypoint set is a full-length portrait type. After determining the humanbody type, the electronic device could obtain the type corresponding toeach candidate key point set corresponding to the background image toobtain a plurality of types. And then, the electronic device coulddetermine a type matching the human body type from the plurality oftypes and determine the candidate key point set corresponding to thetype matching the human body type as the candidate key point setcorresponding to the human body type. For example, assume the human bodytype is the full-length portrait type and the plurality of typescomprise the bust type and the full-length portrait type. Then, theelectronic device could determine the candidate key point setcorresponding to the full-length portrait type of the plurality of typesas the candidate key point set corresponding to the human body type.

In an embodiment, the photographing method could further comprise:

-   -   (1) upon a condition that multiple of candidate key point sets        correspond to the human body type, obtaining a composition        boundary frame according to each of the multiple of candidate        key point sets corresponding to the human body type;    -   (2) determining at least one of the multiple of candidate key        point sets, where the composition boundary frame corresponding        to the at least one of the multiple of the plurality of        candidate key point matches the human body boundary frame, as        the composite key point set corresponding to the photographing        scene.

There can be multiple candidate key point sets corresponding to thehuman body type. For example, the human body type is the full-lengthportrait type and the candidate key point set K1 and the candidate keypoint set K2 both correspond to the full-length portrait type. The onlydifference between the candidate key point set K1 and the candidate keypoint set K2 is that the candidate key point set K1 and the candidatekey point set K2 have candidate key points located in differentpositions in the screen coordinate system. In this case, the candidatekey point set corresponding to the human body type comprises thecandidate key point set K1 and the candidate key point set K2.

In this embodiment, when the electronic device sets different candidatekey point sets for each predetermined background image, the electronicdevice could set different composition boundary frames for eachpredetermined background images. Here, each candidate key point setcorresponds to a composition boundary frame. When the human body typecorresponds to multiple candidate key point sets, for the candidatecomposition key point set corresponding to each human body type, theelectronic device could obtain its corresponding composition boundaryframe. And then, the electronic device could determine a candidate keypoint set matching the human body boundary frame from the multiplecandidate key point sets corresponding to the human body type as thecomposition key point set corresponding to the photographing scene.

Upon a condition that the difference between the height of thecomposition boundary frame corresponding to a certain candidate keypoint set and the height of the human body boundary frame is within afirst predetermined difference range and the difference between thewidth of the composition boundary frame corresponding to a certaincandidate key point set and the width of the human body boundary frameis within a second predetermined difference range, the electronic devicecould determine that the composition boundary frame corresponding to thecandidate key point set matches the human boundary frame. Here, thefirst predetermined difference range and the second predetermineddifference range could be pre-stored in the electronic device.

In some embodiments, when a plurality of candidate key point sets fromthe candidates key point sets corresponding to the human body typematching the human body boundary frame are determined as first candidatekey point sets, the electronic device could further obtain the left topcorner coordinate of the composition boundary frame corresponding toeach first candidate key point set and the left top corner coordinate ofthe human body boundary frame. Furthermore, the electronic devicedetermines at least one first candidate key point set whose compositionboundary frame has a left top corner coordinate identical to the lefttop corner coordinate of the human body boundary frame, as thecomposition key point set corresponding to the photographing scene.

In some other embodiments, when a plurality of first candidate key pointsets, whose composition boundary frames have a left top cornercoordinate identical to the left top corner coordinate of the human bodyboundary frame, as the second candidate key point set, the electronicdevice could further obtain the right bottom corner coordinate of thecomposition boundary frame corresponding to each second candidate keypoint set and the right bottom corner coordinate of the human bodyboundary frame. Furthermore, the electronic device determines at leastone second candidate key point set whose composition boundary frame hasa right bottom coordinate identical to the right bottom cornercoordinate of the human body boundary frame, as the composition keypoint set corresponding to the photographing scene.

In some embodiments, the electronic device could pre-store a compositiondatabase. The composition database could be defined as a hash table. Thehash table is a data structure that can map keys to values. A hash tableuses a hash function to compute an index, also called a hash code, intoan array of buckets or slots, from which the desired value can be found.During lookup, the key is hashed and the resulting hash indicates wherethe corresponding value is stored. In the composition database, the keysrepresents each predetermined preview image, such as the “water view”image, the “mountain view” image, the “snow view” image, etc. The valuesrepresent the candidate key point set and the composition boundary framecorresponding to each predetermined background image. Here, eachcandidate key point set corresponding to each preview background imagecorresponds to a composition boundary frame corresponding to eachpreview background image.

In the actual implementation, after the electronic device divides thepreview image into the foreground image and the background image, theelectronic device could obtain a preview background image matching thebackground image. If the background image is a “water view” image andthe preview background image matching the background image is also a“water view” image, the electronic device could take the previewbackground image matching the background image as a “key”. Theelectronic device could use the key to look up a plurality of candidatekey point sets and a plurality of composition boundary frames in thecomposition database and determine the plurality of candidate key pointsets and the plurality of composition boundary frames as a plurality ofcandidate key point sets and a plurality of composition boundary framescorresponding to the background image.

In an embodiment, the photographing method could further comprisefollowing steps after the step of “determining the composition key pointset corresponding to the photographing scene”:

-   -   (1) calculating distances between each human body key point and        its corresponding composition key point;    -   (2) calculating an average distance of the distances.

Here, the condition that the human body key point set does not match thecomposition key point set comprises: the average distance is greaterthan or equal to a predetermined average distance.

For example, assume that the human body key point set comprises: a nodeN1, a left eye LE1 and a right eye RE1 and the composition key point setcomprises a nose N2, a left eye LE2 and a right eye RE2. The electronicdevice could calculate the distance L1 between the nose N1 and the noseN2, the distance L2 between the left eye LE1 and the left eye LE2, andthe distance L3 between the right eye RE1 and the right eye RE2. Andthen, the electronic device could calculate an average distance of thedistances L1, L2 and L3. Upon a condition that the average distance isgreater than or equal to the average distance, the electronic devicecould determine that the human body key point set does not match thecomposition key point. It should be noticed that when the averagedistance is less than the predetermined average distance, the electronicdevice could determine that the human body key point set matches thecomposition key point set. Here, the predetermined average distancecould be pre-stored in the electronic device according to the actualimplementation. There is no specific limitation here.

In an embodiment, the step of “generating and outputting the promptmessage to adjust the attitude of the electronic device” comprises:

-   -   (1) generating a plurality of candidate vectors;    -   (2) predicting a target human body key point set obtained after        adjusting the attitude of the electronic device according to        each of the candidate vectors;    -   (3) determining a candidate vector of the plurality of candidate        vectors as a target vector, wherein the target human body key        point set corresponding to the candidate vector matches the        composition key point set;    -   (4) generating and outputting the prompt message to adjust the        attitude of the electronic device according to the target        vector.

For example, when the human body key point set does not match thecomposition key point set, the electronic device could randomly generatea plurality of candidate vectors. Here, each of the candidate vectorscould comprise its amplitude and direction. For example, a candidatevector could have a one-centimeter amplitude and horizontally rightdirection. And then, the electronic device could predict a target humanbody key point set obtained after the electronic device's attitude isadjusted according to each candidate vector. For example, assume that acertain candidate vector has a one-centimeter amplitude and horizontallyright direction. In this way, the electronic device could predict thetarget human body key point set obtained by performing the key pointdetection on the human body in the current photographing scene after theuser moves the electronic device to the right by one centimeter. Whenthe target human body key point set corresponding to a certain candidatevector matches the composition key point set, the electronic devicecould determine the candidate vector as the target vector. And then, theelectronic device could generate and output the prompt message to adjustthe attitude of the electronic device according to the target vector.For example, assume that the target vector has a one-centimeteramplitude and horizontally right direction. The electronic device couldshow “please move the electronic device to the right by one centimeter”on its display screen. Furthermore, the electronic device could furtherdisplay a progress bar, which corresponds to the above-mentioned onecentimeter. The progress bar could gradually become shorter as theelectronic device moves to the right and become longer as the electronicdevice moves to the left. When the electronic device moves to the rightby one centimeter, the progress bar is gone. Accordingly, the user coulddetermine whether he has moved the electronic device to the right by onecentimeter according to the progress bar.

In an embodiment, the photographing method could further comprisefollowing steps after the step of “determining the composition key pointset corresponding to the photographing scene”:

-   -   (1) determining a human face key point set from the human body        key point set;    -   (2) obtaining a horizontal coordinate of each human face key        point to obtain a plurality of first horizontal coordinates;    -   (3) calculating a first average value of the plurality of first        horizontal coordinates;    -   (4) upon a condition that the first average value is within a        predetermined range, determining a target composition key point        set corresponding to the human face key point set from the        composition key point set.

Here, the condition that the human body key point set does not match thecomposition key point set comprises: the human face key point set doesnot match the target composition key point set.

For example, when a partial human body key point set selected from thehuman body key point set meets a predetermined condition, the electronicdevice could determine whether the human body key point set matches thecomposition key point set based on whether the partial human body keypoint set matches a partial composition key point set in the compositionkey point set.

For example, after obtaining the human body key point set and thecomposition key point set, the electronic device could determine a humanface key point set, such as the nose N1, the left eye LE1 and the righteye RE1, from the human body key point set. And then, the electronicdevice could obtain a horizontal coordinate of each human face key pointin the screen coordinate system to obtain a plurality of firsthorizontal coordinates. And then, the electronic device could calculatea first average value of the plurality of first horizontal coordinates.Upon a condition that the first average value is within a predeterminedrange, the electronic device determines a target composition key pointset, such as the nose N2, the left eye LE2 and the right eye RE2,corresponding to the human face key point set from the composition keypoint set. And then, the electronic device could determine whether thehuman face key point set matches the target composition key point set.If not, then the electronic device could determine that the human bodykey point set does not match the composition key point set. If yes, thenthe electronic device could determine that the human body key point setmatches the composition key point set. The predetermined average rangecould be pre-stored in the electronic device according to actualimplementations.

In an embodiment, the photographing method could further comprisefollowing steps after the step of “determining the target compositionkey point set corresponding to the human face key point set from thecomposition key point set”:

-   -   (1) obtaining a vertical coordinate of each human key point to        obtain a plurality of first vertical coordinates and obtaining a        horizontal coordinate and a vertical coordinate of each target        composition key point to obtain a plurality of first vertical        coordinates and a plurality of second horizontal coordinates;    -   (2) calculating a second average value of the plurality of first        vertical coordinates, a third average value of the plurality of        first vertical coordinates and a fourth average value of the        plurality of second horizontal coordinates;    -   (3) determining a first target coordinate according to the first        average value and the second average value and determining a        second target coordinate according to the third average value        and the fourth average value;    -   (4) calculating a first distance between the first target        coordinate and the second target coordinate.

Here, the condition that the human body key point set does not match thecomposition key point set comprises: the first distance is greater thanor equal to a first predetermined distance.

For example, assume that the human face key point set comprises a noseN1, a left eye LE1 and a right eye RE1; and the target composition keypoint set comprises a nose N2, a left eye LE2 and a right eye RE2.Assume that the nose N1 has a horizontal coordinate 1 and a verticalcoordinate 2; the left eye LE1 has a horizontal coordinate 4 and avertical coordinate 1; the right eye RE1 has a horizontal coordinate 4and a vertical coordinate 3; the nose N2 has a horizontal coordinate 3and a vertical coordinate 3, the left eye LE2 has a horizontalcoordinate 6 and a vertical coordinate 2; the right eye RE2 has ahorizontal coordinate 6 and a vertical coordinate 4; and the firstpredetermined distance is 2. In this case, the first average value is 3,the second average value is 2, the third average value is 5, and thefourth average value is 3. The first target coordinate is (3, 2) and thesecond target coordinate is (5, 3). The distance between the firsttarget coordinate and the second coordinate is √{square root over (5)}.From the above, it could be determined that the first distance isgreater than the first predetermined distance. Therefore, the electronicdevice could determine that the human face key point set does not matchthe target composition key point set and further determined that thehuman body key point set does not match the composition key point set.Here, the nose N1, the left eye LE1, the right eye RE1, the nose N2, theleft eye LE2, the right eye RE2 have their own horizontal and verticalcoordinates in the screen coordinate system. The first predetermineddistance could be pre-stored in the electronic device according to theactual implementations.

In an embodiment, the step of “generating and outputting the promptmessage to adjust the attitude of the electronic device” comprises:

-   -   (1) determining a first moving direction according to a first        target coordinate and a second target coordinate;    -   (2) generating and outputting the prompt message to adjust the        attitude of the electronic device according to the first moving        direction and the first distance.

It could be understood that the first moving direction could be adirection from the first target coordinate to the second targetcoordinate. Assume that the first moving direction is a horizontaldirection toward the right and the first distance is Then, theelectronic device could display “please move your electronic device tothe right horizontally” on its display screen. Furthermore, theelectronic device could display a progress bar on the display screen.The process bar corresponds to the first distance and could graduallybecome shorter as the electronic device moves to the right and becomelonger as the electronic device moves to the left. When the electronicdevice moves to the right by the first distance, the progress bar isgone. Accordingly, the user could determine whether to stop moving theelectronic device according to the appearance of the progress bar.

In an embodiment, the photographing method could further comprisefollowing steps after the step of “calculating the first average valueof the plurality of first horizontal coordinates”:

-   -   (1) upon a condition that the first average is not within the        predetermined range, detecting whether the human body key point        set has a predetermined key point;    -   (2) upon a condition that the human body key point set does not        have a predetermined key point, obtaining a first center        coordinate of the human body boundary frame and a second center        coordinate of the composition boundary frame corresponding to        the composition key point set;    -   (3) calculating a second distance between the first center        coordinate and the second center coordinate.

Here, the condition that the human body key point set does not match thecomposition key point set comprises: the second distance is greater thanor equal to a second predetermined distance.

For example, upon a condition that the first average is not within thepredetermined range, the electronic device could further detect whetherthe human body key point set has a predetermined key point. Upon acondition that the human body key point set does not have apredetermined key point, the electronic device could further obtain acenter coordinate of the human boundary frame (a first centercoordinate) and a center coordinate of the composition boundary frame (asecond center coordinate) corresponding to the composition key pointset. And then, the electronic device could calculate a second distancebetween the first center coordinate and the second center coordinate.Upon a condition that the second distance is greater than or equal tothe second predetermined distance, the electronic device could determinethat the human body key point set does not match the composition keypoint set. Upon a condition that the second distance is less than thesecond predetermined distance, the electronic device could determinethat the human body key point set matches the composition key point set.Here, the first center coordinate and the second center coordinate areboth coordinates in the screen coordinate system. The secondpredetermined distance could be pre-stored in the electronic deviceaccording to the actual implementations. The predetermined key pointscould comprise a left knee, a right knew, a left ankle and a rightankle.

For example, when the human body key point set does not have thepredetermined key point and assume that the first center coordinate is(1, 1), the second center coordinate is (3, 3) and the secondpredetermined distance is 2, it could be determined that the seconddistance is √{square root over (8)}, which is greater than the secondpredetermined distance. Therefore, the electronic device could determinethat the human body key point set does not match the composition keypoint set.

In an embodiment, the step of “generating and outputting the promptmessage to adjust the attitude of the electronic device” comprises:

-   -   (1) determining a second moving direction according to the first        center coordinate and the second center coordinate;    -   (2) generating and outputting the prompt message to adjust the        attitude of the electronic device according to the second moving        direction and the second distance.

The second moving direction could be a direction from the first targetcoordinate to the second target coordinate. Assume that the secondmoving direction is a horizontal direction toward the right and thefirst distance is √{square root over (8)}. Then, the electronic devicecould display “please move your electronic device to the righthorizontally” on its display screen. Furthermore, the electronic devicecould display a progress bar on the display screen. The process barcorresponds to the second distance and could gradually become shorter asthe electronic device moves to the right and become longer as theelectronic device moves to the left. When the electronic device moves tothe right by the second distance, the progress bar is gone. Accordingly,the user could determine whether to stop moving the electronic deviceaccording to the appearance of the progress bar.

In an embodiment, the photographing method could further comprisefollowing steps after the step of “detecting whether the human body keypoint set has a predetermined key point”:

-   -   (1) upon a condition that the human key point set has the        predetermined key point, obtaining a first center horizontal        coordinate of the human body boundary frame and a second center        horizontal coordinate of the composition boundary frame        corresponding to the composition key point set;    -   (2) determining a target composition key point set corresponding        to the human face key point set from the composition key point        set;    -   (3) obtaining a vertical coordinate of each human face key point        to obtain a plurality of third vertical coordinates and        obtaining a vertical coordinate of each composition key point to        obtain a plurality of fourth vertical coordinates;    -   (4) calculating a fifth average value of the plurality of third        vertical coordinates and a sixth average value of the plurality        of fourth vertical coordinates;    -   (5) determining a third target coordinate according to the first        center horizontal coordinate and the fifth average value and        determining a fourth target coordinate according to the second        center horizontal coordinate and the sixth average value;    -   (6) calculating a third distance between the third target        coordinate and the fourth target coordinate.

Here, the condition that the human body key point set does not match thecomposition key point set comprises: the third distance is greater thanor equal to a third predetermined distance.

For example, assume the human body key point set has the predeterminedkey point and the human face key point set comprises a nose N1, a lefteye LE1 and a right eye RE1 and the target composition key point setcomprises a nose N2, a left eye LE2 and a right eye RE2. Furthermore,assume that the nose N1 has a vertical coordinate 2; the left eye LE1has a vertical coordinate 1; the right eye RE1 has a vertical coordinate3; the nose N2 has a vertical coordinate 3, the left eye LE2 has a avertical coordinate 2; the right eye RE2 has a vertical coordinate 4;the first center horizontal coordinate of the human body boundary frameis 2; the second center horizontal coordinate of the compositionboundary frame of the composition key point set is 4; and thepredetermined third distance is 2. In this case, the fifth average valueis 2 and the sixth average value is 3. The third target coordinate is(2, 2) and the fourth target coordinate is (4, 3). The third distancebetween the third target coordinate and the fourth target coordinate is√{square root over (5)}. Thus, the third distance is greater than thethird predetermined distance. In this way, the electronic device coulddetermine that the human body key point set does not match thecomposition key point set. It could be understood that if the thirddistance is less than the predetermined distance, then the electronicdevice could determine that the human body key point set matches thecomposition key point set. Here, the first center horizontal coordinateof the human body boundary frame is the horizontal coordinate of thecenter of the human boundary frame in the screen coordinate system. Thesecond center horizontal coordinate of the composition boundary framecorresponding to the composition key point set is the horizontalcoordinate of the center of the composition boundary frame correspondingto the composition key point set in the screen coordinate system. Thepredetermined third distance could be pre-stored in the electronicdevice according to the actual implementations. The predetermined keypoints could comprise a left knee, a right knee, a left ankle and aright ankle.

In an embodiment, the step of “generating and outputting the promptmessage to the attitude of the electronic device” comprises:

-   -   (1) determining a third direction according to the third target        coordinate and the fourth target coordinate;    -   (2) generating and outputting the prompt message to adjust the        attitude of the electronic device according to the third moving        direction and the third distance.

It could be understood that the third moving direction could be adirection from the third target coordinate to the fourth targetcoordinate. Assume that the third moving direction is a horizontaldirection toward the right and the third distance is √{square root over(5)}. Then, the electronic device could display “please move yourelectronic device to the right horizontally” on its display screen.Furthermore, the electronic device could display a progress bar on thedisplay screen. The process bar corresponds to the third distance andcould gradually become shorter as the electronic device moves to theright and become longer as the electronic device moves to the left. Whenthe electronic device moves to the right by the third distance, theprogress bar is gone. Accordingly, the user could determine whether tostop moving the electronic device according to the appearance of theprogress bar.

In an embodiment, the photographing method could further comprisefollowing steps before the step of “performing the key point detectionon the human body in the photographing scene to obtain the human bodykey point set of the human body”:

-   -   (1) detecting whether the electronic device is in a        predetermined condition;    -   (2) upon a condition that the electronic device is in the        predetermined condition, performing the key point detection on        the human body in the photographing scene to obtain the human        body key point set of the human body;    -   (3) upon a condition that the electronic device is not in the        predetermined condition, generating and outputting a prompt        message to adjust the attitude of the electronic device;    -   (4) upon a condition that the adjusted electronic device is in        the predetermined condition, performing the key point detection        on the human body in the photographing scene to obtain the human        body key point set of the human body.

For example, the predetermined condition could be a horizontalcondition. In order to take a better picture, before performing the keypoint detection on the human body in the photographing scene to obtainthe human body key point set of the human body, the electronic devicecould obtain the pitch and roll angles through the position sensor, suchas a gyroscope. And then, the electronic device could determine whetherit's in a horizontal condition according to the pitch and roll angles.If the pitch angle and the roll angle are both 180 degrees, theelectronic device could determine that the electronic device is in thehorizontal condition. And then, the electronic device could perform thekey point detection on the human body in the photographing scene toobtain the human body key point set of the human body. If the pitchangle is not 180 degrees or the roll angle is not 180 degrees, theelectronic device is not in the horizontal condition. The electronicdevice could generate and output a prompt message to adjust the attitudeof the electronic device. For example, the prompt message could be“please adjust the electronic device to be in a horizontal condition.”While the user is adjusting the attitude of the electronic device, theelectronic device could keep detecting whether the pitch angle and theroll angle are both 180 degrees. When the pitch angle and the roll angleare both detected to be 180 degrees, the electronic device couldgenerate a prompt message. The prompt message is used to tell the userto cease to adjust the attitude of the electronic device. After theelectronic device is adjusted to be in the horizontal condition, theelectronic device could perform the key point detection on the humanbody in the photographing scene to obtain the human body key point setof the human body.

In addition, the predetermined condition could be a vertical condition.In order to take a better picture, before performing the key pointdetection on the human body in the photographing scene to obtain thehuman body key point set of the human body, the electronic device couldobtain the pitch and roll angles through the position sensor, such as agyroscope. And then, the electronic device could determine whether it'sin a vertical condition according to the pitch and roll angles. If thepitch angle and the roll angle are both 90 degrees, the electronicdevice could determine that the electronic device is in the verticalcondition. And then, the electronic device could perform the key pointdetection on the human body in the photographing scene to obtain thehuman body key point set of the human body. If the pitch angle is not 90degrees or the roll angle is not 90 degrees, the electronic device isnot in the vertical condition. The electronic device could generate andoutput a prompt message to adjust the attitude of the electronic device.For example, the prompt message could be “please adjust the electronicdevice to be in a vertical condition.” While the user is adjusting theattitude of the electronic device, the electronic device could keepdetecting whether the pitch angle and the roll angle are both 90degrees. When the pitch angle and the roll angle are both detected to be90 degrees, the electronic device could generate a prompt message. Theprompt message is used to tell the user to cease to adjust the attitudeof the electronic device. After the electronic device is adjusted to bein the vertical condition, the electronic device could perform the keypoint detection on the human body in the photographing scene to obtainthe human body key point set of the human body.

It could be understood that adjusting the attitude of the electronicdevice could make the electronic device in the horizontal condition orthe vertical condition relative to the ground. In the actualimplementation, adjusting the attitude of the electronic device couldmake the electronic device in a horizontal forward condition, ahorizontal backward condition, a horizontal leftward condition, ahorizontal rightward condition, a vertical upward condition, and avertical downward condition relative to the user based on any positioncondition (including the horizontal condition and the verticalcondition).

Please refer to FIG. 2. FIG. 2 is a flow chart of a photographing methodaccording to another embodiment of the present disclosure. Thephotographing method could be performed by an electronic device. Thephotographing method comprises blocks 201-212.

Block 201: An electronic device obtains a preview image of aphotographing scene.

For example, as shown in FIG. 3, the electronic device could obtain apreview image G1 of the photographing scene.

Here, after the electronic device activates a photographing applicationbased on the user's operation (such as an application “camera” in theelectronic device), the scene that camera is aiming is the photographingscene.

Block 202: The electronic device utilizes a portrait detection model toperform a portrait detection on the preview image to obtain a human bodyboundary frame.

For example, as shown in FIG. 4, after obtaining the preview image G1,the electronic device could utilize a predetermined portrait detectionmodel to perform a portrait detection on the preview image G1 to obtaina human body boundary frame B1.

It should be noted that the electronic device could finish the flow ifthe electronic device obtains multiple human body boundary frames or nohuman body boundary frame when the electronic device utilizes thepredetermined portrait detection model to perform the portrait detectionon the preview image G1.

Block 203: the electronic device cuts the preview image based on thehuman body boundary frame to obtain a human body image.

For example, as shown in FIG. 5, after obtaining the human body boundaryframe B1, the electronic device could cut the preview image along thehuman body boundary frame B1 to obtain the human body image G2.

Block 204: The electronic device utilizes a key point detection model toperform the human body key point detection on the human body image toobtain the key point set of the human body.

For example, after obtaining the human image G2, the electronic devicecould utilize a predetermined key point detection model to perform thehuman body key point detection on the human body image G2 to obtain thekey point set of the human body. Here, the human body key point setcould comprise one or more human body key points, including a nose, aleft eye, a right eye, a left ear, a right ear, a neck, a left shoulder,a right shoulder, a left elbow, a right elbow, a left wrist, a rightwrist, a left buttock, a right buttock, a left knee, a right knee, aleft ankle and a right ankle.

Block 205: The electronic device divides the preview image into aforeground image and a background image.

In this embodiment, before the electronic device obtains the previewimage of the photographing scene, the electronic device could obtainmultiple image sample and the foreground tag and the background tag ofeach image sample. And then, the electronic device could utilizemultiple image samples and the foreground tag and the background tag ofeach image sample to a convolutional neural network or other traindeep-learning models to get a trained model. This trained model could beused as a predetermined scene identification model.

Here, the foreground tag is used to describe an item that could beidentified by a rectangular frame and located in an apparent position ofthe image sample. The background tag is used to describe an overallinformation of the image sample. For example, the background tag couldbe “mountain view”, “water view”, “snow view”, “rain view”, etc. Theforeground tag could be “human”, “cat”, “dog”, etc. For example, for animage sample with “a person standing by a lake”, the foreground tagcould be “human” and the background tag could be “water view”.

For example, after obtaining the preview image G1, the electronic devicecould utilize the trained scene identification model to perform thescene identification on the preview image G1 to obtain the foregroundtag and the background tag of the preview image G1 such that theelectronic device divides the preview image G1 into the foreground imageand the background image according to the foreground tag and thebackground tag. For the preview image G1, the electronic deviceidentifies that the background tag is “mountain view”. Then, thebackground image is a “mountain view” image. In addition, the electronicdevice identifies that the foreground tag is “human”. Then, theforeground image is an image having a “human” in it.

Block 206: the electronic device determines a plurality of candidate keypint sets corresponding to the background image.

It could be understood that in this embodiment, the electronic devicecould preset a plurality of the predetermined background images and setdifferent candidate key point sets having reasonable compositions foreach predetermined background images. Here, the predetermined backgroundimages could be a “water view” image, a “mountain view” image, a “snowview” image, etc. Each candidate key point set could comprise one ormore human body key points, including a nose, a left eye, a right eye, aleft ear, a right ear, a neck, a left shoulder, a right shoulder, a leftelbow, a right elbow, a left wrist, a right wrist, a left buttock, aright buttock, a left knee, a right knee, a left ankle and a rightankle.

For example, after dividing the preview image G1 into the foregroundimage and the background image, the electronic device could obtain aplurality of predetermined background images. And then, the electroniccould determine whether the plurality of background images have apredetermined background image matching the background image. Whendetermining that there is one predetermined background image matchingthe background image, the electronic device could obtain the pluralityof the candidate key point sets corresponding to the predeterminedbackground image and take them as the plurality of the candidate keypoint sets corresponding to the background image.

Block 207: The electronic device determines a human body type of thehuman body.

Block 208: The electronic device determines at least one of theplurality of candidate key point sets that is corresponding to the humanbody type as the composition key point set corresponding to thephotographing scene.

In this embodiment, when the plurality of candidate key point setscorresponding to the background image are obtained, the electronicdevice could determine the human body type of the human body in thephotographing scene. And then, the electronic device could determine atleast one of the plurality of candidate key point sets that iscorresponding to the human body type as the composition key point setcorresponding to the photographing scene.

It could be understood that when the electronic device sets a pluralityof candidate key point sets for each predetermined background image, theelectronic device could further set corresponding types for eachcandidate key point set corresponding to each predetermined backgroundimage. For example, if a certain key point set comprises key pointshigher than a human chest, including a nose, a left eye, a right eye, aleft ear, a right ear, a neck, a left shoulder, and a right shoulder,the electronic device could determine that the type corresponding to thecandidate key point set is a bust type. If a certain candidate key pointset comprises key points of the entire human body, including a nose, aleft eye, a right eye, a left ear, a right ear, a neck, a left shoulder,a right shoulder, a left elbow, a right elbow, a left wrist, a rightwrist, a left butt, a right butt, a left knee, a right knee, a leftankle and a right ankle, the electronic device could determine that thetype of the candidate key point set is a full-length portrait type.After determining the human body type, the electronic device couldobtain the type corresponding to each candidate key point setcorresponding to the background image to obtain a plurality of types.And then, the electronic device could determine a type matching thehuman body type from the plurality of types and determine the candidatekey point set corresponding to the type matching the human body type asthe candidate key point set corresponding to the human body type. Forexample, assume the human body type is the full-length portrait type andthe plurality of types comprise the bust type and the full-lengthportrait type. Then, the electronic device could determine the candidatekey point set corresponding to the full-length portrait type of theplurality of types as the candidate key point set corresponding to thehuman body type.

Block 209: The electronic device calculates distances between each humanbody key point and its corresponding composition key point.

Block 210: The electronic device calculates an average distance of thedistances.

For example, when the human body key point set and the composition keypoint set are obtained, the electronic device could calculate distancesbetween each human body key point and its corresponding composition keypoint. For instance, assume that the human body key point set comprises:a nose N1, a left eye LE1 and a right eye RE1, a left ear LAL a rightear RAL and a neck K1. The composition key point set comprises: a noseN2, a left eye LE2 and a right eye RE2, a left ear LA2, a right ear RA2,and a neck K2. The electronic device could calculate a distance L1between the nose N1 and the nose N2. Assume that the nose N1 is (1, 2),the nose N2 is (3, 3). Then the distance between the nose N1 and thenose N2 is √{square root over (5)}. Similarly, the electronic devicecould calculate the distance L2 between the left eye LE1 and the lefteye LE2, the distance L3 between the right eye RE1 and the right eyeRE2, the distance L4 between the left ear LA1 and the left ear LA2, thedistance L5 between the right ear RA1 and the right ear RA2, and thedistance L6 between the neck K1 and the neck K2.

After obtaining the distances L1, L2, L3, L4, L5 and L6, the electronicdevice could calculate the average distance of the distances L1, L2, L3,L4, L5 and L6. For example, assume L1 is √{square root over (5)}, L2 is√{square root over (5)}, L3 is 4, L4 is 3, L5 is 2 and L6 is 4. Then theaverage distance is 3.

Block 211: In response to the average distance being greater than orequal to the predetermined average distance, the electronic devicegenerates and outputs the prompt message to adjust the attitude of theelectronic device.

For example, after obtaining the average distance, the electronic devicecould determine whether the average distance is greater than or equal tothe predetermined average distance. Upon a condition that the averagedistance is greater than or equal to the predetermined average distance,the electronic device generates and outputs the prompt message to adjustthe attitude of the electronic device such that the user could adjustthe attitude of the electronic device according to the prompt message.In this way, after the attitude of the electronic device is adjusted,the current average distance obtained by the electronic device is lessthan the predetermined distance. Here, the predetermined distance couldbe pre-stored in the electronic device.

It could be understood that as the attitude change of the electronicdevice, the photographing scene changes accordingly. As the change ofthe photographing scene, the positions of the human body key points inthe human body key point set obtained by performing the key pointdetection on the human body in the photographing scene. As the change ofthe positions of the human body key points, the distance between eachhuman body key point and its corresponding composition key pointchanges. As the change of the distance, the average change calculated bythe electronic device changes according. This changing average distanceis the current average distance.

For example, when the average distance is greater than or equal to thepredetermined average distance, the electronic device could generate aplurality of candidate vectors. Here, each of the candidate vectorscould comprise its amplitude and direction. For example, a candidatevector could have a one-centimeter amplitude and horizontally rightdirection. And then, the electronic device could perform the key pointdetection on the human body in the current photographing scene to obtainthe target human body key point set after the user movers the electronicdevice to the right by one centimeter. For each target human body keypoint corresponding to each candidate vector, the electronic devicecould calculate the distances between each target human body key pointand its composition key point corresponding to each candidate vector.And then, the electronic device could calculate the average distance ofthe distances corresponding to each candidate vector. At last, theelectronic device could determine the candidate vector having an averagedistance less than the predetermined average distance as the targetvector.

And then, the electronic device could generate and output the promptmessage to adjust the attitude of the electronic device according to thetarget vector. For example, as shown in FIG. 6, assume that the targetvector has a one-centimeter amplitude and horizontally right direction.And then, the electronic device could display “Please move theelectronic device to the right” in its display screen. Furthermore, theelectronic device could further display a progress bar, whichcorresponds to the above-mentioned one centimeter. The progress barcould gradually become shorter as the electronic device moves to theright and become longer as the electronic device moves to the left. Whenthe electronic device moves to the right by one centimeter, the progressbar is gone. Accordingly, the user could determine whether he has movedthe electronic device to the right by one centimeter according to theprogress bar.

Block 212: In response to the current average distance being less thanthe predetermined average distance, the electronic device performs aphotographing operation on the photographing scene to obtain a targetimage.

As shown in FIG. 7, in this embodiment, when the current averagedistance is less than the predetermined average distance, the electronicdevice could perform a photographing operation on the photographingscene to obtain an image meeting certain aesthetical rules and having areasonable composition (the target image G3). Or, when the currentaverage distance is less than the predetermined average distance, theelectronic device could generate a prompt message to tell the user totake a picture of the photographing scene. In this way, the user couldclick the “shot” button in the camera application to take a picture ofthe photographing scene to obtain a target image that meets certainaesthetical rules.

It could be understood that the electronic device could directly take apicture of the photographing scene when the average distance obtained instep 210 is less than the predetermined average distance to obtain animage meeting certain aesthetical rules and having a reasonablecomposition.

Please refer to FIG. 8. FIG. 8 is a diagram of a photographing deviceaccording to an embodiment of the present disclosure. The photographingdevice is used in an electronic device.

The photographing device 300 comprises a detecting module 301, adetermining module 302, a generating module 303, and a photographingmodule 304.

The detecting module 301 is configured to perform a key point detectionon a human body in a photographing scene to obtain a human body keypoint set of the human body.

The determining module 302 is configured to determine a composition keypoint set corresponding to the photographing scene.

The generating module 303 is configured to generate and output a promptmessage to adjust an attitude of the electronic device upon a conditionthat the human body key point set does not match the composition keypoint set.

The photographing module 304 is configured to perform a photographingoperation on the photographing scene to obtain a target image upon acondition that the human body key point set matches the composition keypoint set.

In some embodiments, the detecting module 301 is configured to: obtain apreview image of the photographing scene; to utilize a portraitdetection model to perform a portrait detection on the preview image toobtain a human body boundary frame; cut the preview image based on thehuman body boundary frame to obtain a human body image; and utilize akey point detection model to perform the key point detection on thehuman body image to obtain the human body key point set of the humanbody.

In some embodiments, the determining module 302 is configured to: dividethe preview image into a foreground image and a background image;determine a plurality of candidate key point sets corresponding to thebackground image; to determine a human body type of the human body; andto determine, from the plurality of candidate key point sets, at leastone of candidate key point sets that is corresponding to the human bodytype as the composition key point set corresponding to the photographingscene.

In some embodiments, the determining module 302 is configured to: obtaina composition boundary frame according to each of the multiple ofcandidate key point sets corresponding to the human body type, inresponse to multiple of the candidate key point sets correspond to thehuman body type; and to determine at least one of the multiple ofcandidate key point sets, where the composition boundary framecorresponding to the at least one of the multiple of candidate key pointmatches the human body boundary frame, as the composite key point setcorresponding to the photographing scene.

In some embodiments, the determining module 302 is configured tocalculate distances between each human body key point and itscorresponding composition key point, and to calculate an averagedistance of the distances. The generating module 303 is configured togenerate and output a prompt message to adjust an attitude of theelectronic device upon a condition that the average distance is greaterthan or equal to a predetermined average distance.

In some embodiments, the generating module 303 is configured to:generate a plurality of candidate vectors; predict a target human bodykey point set obtained after adjusting the attitude of the electronicdevice according to each of the candidate vectors; determine a candidatevector of the plurality of candidate vectors as a target vector, wherethe target human body key point set corresponding to the candidatevector matches the composition key point set; generate and output theprompt message to adjust the attitude of the electronic device accordingto the target vector.

In some embodiments, the determining module 302 is configured to:determine a human face key point set from the human body key point set;obtain a horizontal coordinate of each human face key point to obtain aplurality of first horizontal coordinates; calculate a first averagevalue of the plurality of first horizontal coordinates; determine atarget composition key point set corresponding to the human face keypoint set from the composition key point set in response to the firstaverage value being within a predetermined range. The generating module303 is configured to generate and output a prompt message to adjust anattitude of the electronic device upon a condition that the human facekey point set does not matching the target composition key point set.

In some embodiments, the determining module 302 is configured to: obtaina vertical coordinate of each human key point to obtain a plurality offirst vertical coordinates and obtaining a horizontal coordinate and avertical coordinate of each target composition key point to obtain aplurality of first vertical coordinates and a plurality of secondhorizontal coordinates; calculate a second average value of theplurality of first vertical coordinates, a third average value of theplurality of first vertical coordinates and a fourth average value ofthe plurality of second horizontal coordinates; determine a first targetcoordinate according to the first average value and the second averagevalue and determining a second target coordinate according to the thirdaverage value and the fourth average value; calculate a first distancebetween the first target coordinate and the second target coordinate.The generating module 303 is configured to generate and output a promptmessage to adjust an attitude of the electronic device upon a conditionthat the first distance is greater than or equal to a firstpredetermined distance.

In some embodiments, the determining module 302 is configured to: detectwhether the human body key point set has a predetermined key point inresponse to the first average not within the predetermined range; obtaina first center coordinate of the human body boundary frame and a secondcenter coordinate of the composition boundary frame corresponding to thecomposition key point set in response to the human body key point setnot having a predetermined key point; calculate a second distancebetween the first center coordinate and the second center coordinate.The generating module 303 is configured to generate and output a promptmessage to adjust an attitude of the electronic device upon a conditionthat the second distance is greater than or equal to a secondpredetermined distance.

In some embodiments, the determining module 302 is configured to: obtaina first center horizontal coordinate of the human body boundary frameand a second center horizontal coordinate of the composition boundaryframe corresponding to the composition key point set in response to thehuman key point set having the predetermined key point; determine atarget composition key point set corresponding to the human face keypoint set from the composition key point set; obtain a verticalcoordinate of each human face key point to obtain a plurality of thirdvertical coordinates and obtaining a vertical coordinate of eachcomposition key point to obtain a plurality of fourth verticalcoordinates; calculate a fifth average value of the plurality of thirdvertical coordinates and a sixth average value of the plurality offourth vertical coordinates; determine a third target coordinateaccording to the first center horizontal coordinate and the fifthaverage value and determining a fourth target coordinate according tothe second center horizontal coordinate and the sixth average value;calculate a third distance between the third target coordinate and thefourth target coordinate. The generating module 303 is configured togenerate and output a prompt message to adjust an attitude of theelectronic device upon a condition that the third distance is greaterthan or equal to a third predetermined distance.

Embodiments of the present disclosure are directed to a non-transitorystorage medium storing computer program. A computer executes thecomputer programs to perform operations as provided in the abovephotographing method.

According to an embodiment of the present disclosure, an electronicdevice is disclosed. The electronic device comprises a storage deviceand a processor. The storage device stores computer program. Theprocessor is configured to execute the computer program stored in thestorage device to perform the above-mentioned photographing method.

The above-mentioned electronic device could be a mobile terminal, suchas a tablet or a smart phone. Please refer to FIG. 9. FIG. 9 is adiagram of an electronic device according to an embodiment of thepresent disclosure.

The electronic device 400 comprises a photographing module 401, astorage device 402 and a processor 403. A person having ordinary skillsin the art could understand that the structure shown in FIG. 9 is not alimitation of the electronic device. The electronic device couldcomprise more or less components, or a combination of some components orhave a different configuration.

The photographing module 401 comprises a lens, an image sensor, and animage signal processor. The lens is used to collect an external lightand to provide the collected light to the image sensor. The image sensoris configured to sense the light signal from the lens and transform thelight signal into a digitized raw image (the RAW image) and to providethe RAW image to the image signal processor. The image signal processorcould perform a format conversion and a noise reduction on the RAW imageto obtain a YUV image. Here, RAW is a format that has not been processedor compressed and could be called “digital film.” In addition, YUV is acolor format, where Y represents a luminance, U represents achromaticity, and V represents a concentration. The user couldintuitively sense the natural characteristic form the YUV image throughhis eyes.

The storage device 402 is configured to store application programs anddata. The application programs stored in the storage device 402 compriseexecutable codes. The program codes could form all kinds of functionalblock. The processor 403 could perform all kinds offunctions/application or data processing by executing the applicationprograms in the storage device 402.

The processor 403 is the control center of the electronic device and isconnected to the other components in the electronic device throughinterfaces and buses. The processor 403 executes the applicationprograms stored in the storage device and loads the data stored in thestorage device to perform all kinds of functions of the electronicdevice and process data to monitor the electric device.

In this embodiment, the processor 403 in the electronic device followsthe instructions to load the executable program codes of one or moreapplication programs into the storage device and execute the applicationprograms stored in the storage device to perform operations comprising:

-   -   performing a key point detection on a human body in a        photographing scene to obtain a human body key point set of the        human body;    -   determining a composition key point set corresponding to the        photographing scene;    -   in response to the human body key point set not matching the        composition key point set, generating and outputting a prompt        message to adjust an attitude of the electronic device; and    -   in response to the human body key point set matching the        composition key point set, performing a photographing operation        on the photographing scene to obtain a target image.

Please refer to FIG. 10. The electronic device could comprise aphotographing module 401, a storage device 402, a processor 403, a touchpanel 404, a speaker 405, and a sensor 406.

The photographing module 403 could comprise an image processing circuit.The image processing circuit could be implemented with hardware and/orsoftware. The image processing circuit could comprise all kinds ofprocessing units defined as an image signal processing unit. The imageprocessing circuit at least could comprise a camera, an image signalprocessor (ISP), a control logic, an image storage device and a display.Here, the camera could at least comprise one or more lenses and imagesensors. The image sensor could comprise a color filter array (such asBayer filter). The image sensor could obtain light amplitude andwavelength information captured by each pixel of the image sensor andprovide raw image data processed by the image signal processor.

The image signal processor could process the raw image data pixel bypixel according to multiple formats. For example, each pixel could have8, 10, 12, or 14-bit bit-depth. The image signal processor could performone or more image processing operations on the raw image data andcollect the statistics information of the image data. Here, the imageprocessing operations could be performed according to the same ordifferent bit-depths. After the raw image data are processed by theimage signal processor, the processed image data could be stored in theimage storage device. The image signal processor could receive the imagedata from the image storage device.

The image storage device could be a part of a memory, a storage device,or an independent storage device of the electronic device. The imagestorage device could have direct memory access (DMA) characteristic.

When receiving the image data from the image storage device, the imagesignal processor could perform one or more image processing operations,such as a time-domain filtering. The processed image data could be sentto the image storage device for further process before being displayed.The image signal processor could further receive the processed data fromthe image storage device and perform the image data processing on theprocessed in the original domain and RGB/YCbCr color spaces. Theprocessed image data could be outputted to the display for the user'sview and/or for a graphic engine/graphic processing unit (GPU) forfurther processing. In addition, the output of the image signalprocessor could be sent to the image storage device and the displaycould read the image data from the image storage device. In anembodiment, the image storage device could be implemented with one ormore frame buffers.

The statistic data determined by the image signal processor could besent to the control logic. For example, the statistic data couldcomprise auto exposure, auto white balance, auto focus, flash detection,black voltage level compensation, lens shadow calibration of the imagesensor.

The control logic could comprise a processor and/or a microcontrollerthat executes one or more routines (such as firmware). The one or moreroutines could determine the control parameters of the camera and theISP control parameters according to the received statistics data. Forexample, the control parameters of the camera could comprise a cameraflash control parameter, lens control parameters (such as focusing orzooming focal distances), or a combination of the parameters. The ISPcontrol parameters could be used for gain level and color adjustmentarray for auto white balance and color adjustment (for example, duringRGB processing period).

Please refer to FIG. 11. FIG. 11 is a diagram of an image processingcircuit according to an embodiment of the present disclosure. As shownin FIG. 11, for simple illustration, only the components related to theimage processing technique are shown in this embodiment.

For example, the image processing circuit could comprise a camera, aimage signal processor, a control logic, an image storage device and adisplay. Here, the camera could comprise one or more lens and imagesensors. In some embodiments, the camera could be one of a long focalcamera or a wide-angle camera.

The first image collected by the camera is transferred to the imagesignal processor for processing. After the image signal processorprocesses the first image, the statistic data of the first image (suchas the luminance, the contrast and the color of the image) could be sentto the control logic. The control logic could determine the controlparameters of the camera according to the statistic data such that thecamera could perform auto focusing and auto exposure operationsaccording to the control parameters. After the image signal processorprocesses the first image, the processed first image could be stored inthe image storage device. The image signal processor could read theimage stored in the image storage device for further processing. Inaddition, the processed first image could be directly transferred to thedisplay for displaying. The display could read the image stored in theimage storage device for displaying.

Furthermore, although not shown in FIG. 11, the electronic device couldfurther comprise a CPU and a power module. The CPU is connected to thecontrol logic, the image signal processor, the image storage device andthe display. The CPU is used to achieve the overall control. The powermodule is used to provide power to all modules.

The application programs stored in the storage device 402 compriseexecutable codes. The application programs could form all kinds offunctional blocks. The processor 403 could execute the applicationprograms stored in the storage device 402 to perform all functions anddata processing.

The processor 403 is the control center of the electronic device and isconnected to the other components in the electronic device throughinterfaces and buses. The processor 403 executes the applicationprograms stored in the storage device 402 and loads the data stored inthe storage device 402 to perform all kinds of functions of theelectronic device and process data to monitor the electric device.

The touch panel 404 could be used to receive the touch control performedby the user on the electronic device. The speaker 405 could play theaudio signals. The sensor 406 could comprise a gyroscope, anacceleration sensor, a direction sensor, and an electromagnetic sensor,for obtaining the current attitude of the electronic device 400.

In this embodiment, the processor 403 in the electronic device followsthe instructions to load the executable program codes of one or moreapplication programs into the storage device 402 and execute theapplication programs stored in the storage device 402 to performoperations comprising:

-   -   performing a key point detection on a human body in a        photographing scene to obtain a human body key point set of the        human body;    -   determining a composition key point set corresponding to the        photographing scene; in response to the human body key point set        not matching the composition key point set, generating and        outputting a prompt message to adjust an attitude of the        electronic device;    -   in response to the human body key point set matching the        composition key point set, performing a photographing operation        on the photographing scene to obtain a target image.

Optionally, the operation of performing the key point detection on thehuman body in the photographing scene to obtain the key point set of thehuman body comprises: obtaining a preview image of the photographingscene; utilizing a portrait detection model to perform a portraitdetection on the preview image to obtain a human body boundary frame;cutting the preview image based on the human body boundary frame toobtain a human body image; and utilizing a key point detection model toperform the key point detection on the human body image to obtain thehuman body key point set of the human body.

Optionally, the operation of determining the composition key point setcorresponding to the photographing scene comprises: dividing the previewimage into a foreground image and a background image; determining aplurality of candidate key point sets corresponding to the backgroundimage; determining a human body type of the human body; and determining,from the plurality of candidate key point sets, at least one ofcandidate key point sets that is corresponding to the human body type asthe composition key point set corresponding to the photographing scene.

Optionally, the operations further comprise: in response to multiple ofthe candidate key point sets correspond to the human body type,obtaining a composition boundary frame according to each of the multipleof candidate key point sets corresponding to the human body type; anddetermining at least one of the multiple of candidate key point sets,where the composition boundary frame corresponding to the at least oneof the multiple of candidate key point matches the human body boundaryframe, as the composite key point set corresponding to the photographingscene.

Optionally, after the operation of determining the composition key pointset corresponding to the photographing scene, the operations furthercomprise: calculating distances between each human body key point andits corresponding composition key point; and calculating an averagedistance of the distances. The processor 403 also performs an operationof generating and outputting a prompt message to adjust an attitude ofthe electronic device in response to the average distance being greaterthan or equal to a predetermined average distance.

Optionally, the operation of generating and outputting the promptmessage to adjust the attitude of the electronic device comprises:generating a plurality of candidate vectors; predicting a target humanbody key point set obtained after adjusting the attitude of theelectronic device according to each of the candidate vectors;determining a candidate vector of the plurality of candidate vectors asa target vector, where the target human body key point set correspondingto the candidate vector matches the composition key point set. Theprocessor 403 also performs an operation of generating and outputtingthe prompt message to adjust the attitude of the electronic deviceaccording to the target vector.

Optionally, after the operation of determining the composition key pointset corresponding to the photographing scene, the operations furthercomprise: determining a human face key point set from the human body keypoint set; obtaining a horizontal coordinate of each human face keypoint to obtain a plurality of first horizontal coordinates; calculatinga first average value of the plurality of first horizontal coordinates;in response to the first average value being within a predeterminedrange, determining a target composition key point set corresponding tothe human face key point set from the composition key point set. Theprocessor 403 also performs an operation of generating and outputting aprompt message to adjust an attitude of the electronic device inresponse to the human face key point set not matching the targetcomposition key point set.

Optionally, after the operation of determining the target compositionkey point set corresponding to the human face key point set from thecomposition key point set, the operations further comprise: obtaining avertical coordinate of each human key point to obtain a plurality offirst vertical coordinates and obtaining a horizontal coordinate and avertical coordinate of each target composition key point to obtain aplurality of first vertical coordinates and a plurality of secondhorizontal coordinates; calculating a second average value of theplurality of first vertical coordinates, a third average value of theplurality of first vertical coordinates and a fourth average value ofthe plurality of second horizontal coordinates; determining a firsttarget coordinate according to the first average value and the secondaverage value and determining a second target coordinate according tothe third average value and the fourth average value; calculating afirst distance between the first target coordinate and the second targetcoordinate. The processor 403 also performs an operation of generatingand outputting a prompt message to adjust an attitude of the electronicdevice in response to the first distance being greater than or equal toa first predetermined distance.

Optionally, after the operation of calculating the first average valueof the plurality of horizontal coordinates, the operation furthercomprise: in response to the first average not within the predeterminedrange, detecting whether the human body key point set has apredetermined key point; in response to the human body key point set nothaving a predetermined key point, obtaining a first center coordinate ofthe human body boundary frame and a second center coordinate of thecomposition boundary frame corresponding to the composition key pointset; calculating a second distance between the first center coordinateand the second center coordinate. The processor 403 also performs anoperation of generating and outputting a prompt message to adjust anattitude of the electronic device in response to the second distancebeing greater than or equal to a second predetermined distance.

Optionally, after the operation of detecting whether the human body keypoint set has the predetermined key point, the operations furthercomprise: in response to the human key point set having thepredetermined key point, obtaining a first center horizontal coordinateof the human body boundary frame and a second center horizontalcoordinate of the composition boundary frame corresponding to thecomposition key point set; determining a target composition key pointset corresponding to the human face key point set from the compositionkey point set; obtaining a vertical coordinate of each human face keypoint to obtain a plurality of third vertical coordinates and obtaininga vertical coordinate of each composition key point to obtain aplurality of fourth vertical coordinates; calculating a fifth averagevalue of the plurality of third vertical coordinates and a sixth averagevalue of the plurality of fourth vertical coordinates; determining athird target coordinate according to the first center horizontalcoordinate and the fifth average value and determining a fourth targetcoordinate according to the second center horizontal coordinate and thesixth average value; calculating a third distance between the thirdtarget coordinate and the fourth target coordinate. The processor 403also performs an operation of generating and outputting a prompt messageto adjust an attitude of the electronic device in response to the thirddistance being greater than or equal to a third predetermined distance.

In the above-mentioned embodiments, the description of each embodimenthas its own emphasis. For parts that are not described in detail in acertain embodiment, reference may be made to the detailed description ofthe photographing method above, which will not be repeated here.

The photographing device according to an embodiment of the presentdisclosure and the above-mentioned photographing method belong to thesame concept. The photographing device could perform photographingmethod in any of the above embodiments. The actual implementation couldbe referred to the embodiments of the photographing method and furtherillustration is omitted here.

Please note, a person having ordinary skills in the art could understandthat a step or more steps in the above-mentioned photographing methodcould be achieved by using a computer program to control relatedhardware. The computer program could be stored in a computer readablemedium, such as a memory. The computer program could be executed by atleast one processor to perform one or more steps in the photographingmethod. The storage medium could be a hard disk, an optical disk, a readonly memory (ROM) or a random access memory (RAM).

In addition, the functional units in the various embodiments of thepresent disclosure may be integrated into a processing module, or eachunit may be physically present individually, or two or more units may beintegrated into one module. The above integrated module may beimplemented by using hardware, or may be implemented by using a softwarefunction module. The integrated module may be stored in a computerreadable storage medium if it is implemented by a software functionmodule and is sold or used as a standalone product. The above-mentionedstorage medium may be a read-only memory, a magnetic disk, or an opticaldisk.

Above are embodiments of the present disclosure, which does not limitthe scope of the present disclosure. Any modifications, equivalentreplacements or improvements within the spirit and principles of theembodiment described above should be covered by the protected scope ofthe disclosure.

What is claimed is:
 1. A photographing method, used in an electronicdevice, the photographing method comprising: performing a key pointdetection on a human body in a photographing scene to obtain a humanbody key point set of the human body; determining a composition keypoint set corresponding to the photographing scene; in response to thehuman body key point set not matching the composition key point set,generating and outputting a prompt message to adjust an attitude of theelectronic device; and in response to the human body key point setmatching the composition key point set, performing a photographingoperation on the photographing scene to obtain a target image.
 2. Thephotographing method of claim 1, wherein the step of performing the keypoint detection on the human body in the photographing scene to obtainthe key point set of the human body comprises: obtaining a preview imageof the photographing scene; utilizing a portrait detection model toperform a portrait detection on the preview image to obtain a human bodyboundary frame; cutting the preview image based on the human bodyboundary frame to obtain a human body image; and utilizing a key pointdetection model to perform the key point detection on the human bodyimage to obtain the human body key point set of the human body.
 3. Thephotographing method of claim 2, wherein the step of determining thecomposition key point set corresponding to the photographing scenecomprises: dividing the preview image into a foreground image and abackground image; determining a plurality of candidate key point setscorresponding to the background image; determining a human body type ofthe human body; and determining, from the plurality of candidate keypoint sets, at least one of candidate key point sets that iscorresponding to the human body type as the composition key point setcorresponding to the photographing scene.
 4. The photographing method ofclaim 3, further comprising: in response to multiple of the candidatekey point sets correspond to the human body type, obtaining acomposition boundary frame according to each of the multiple ofcandidate key point sets corresponding to the human body type; anddetermining at least one of the multiple of candidate key point sets,where the composition boundary frame corresponding to the at least oneof the multiple of candidate key point matches the human body boundaryframe, as the composite key point set corresponding to the photographingscene.
 5. The photographing method of claim 1, wherein after the step ofdetermining the composition key point set corresponding to thephotographing scene, the photographing method further comprises:calculating distances between each human body key point and itscorresponding composition key point; and calculating an average distanceof the distances; wherein the human body key point set not matching thecomposition key point set comprises: the average distance being greaterthan or equal to a predetermined average distance.
 6. The photographingmethod of claim 5, wherein the step of generating and outputting theprompt message to adjust the attitude of the electronic devicecomprises: generating a plurality of candidate vectors; predicting atarget human body key point set obtained after adjusting the attitude ofthe electronic device according to each of the candidate vectors;determining a candidate vector of the plurality of candidate vectors asa target vector, wherein the target human body key point setcorresponding to the candidate vector matches the composition key pointset; and generating and outputting the prompt message to adjust theattitude of the electronic device according to the target vector.
 7. Thephotographing method of claim 1, wherein after the step of determiningthe composition key point set corresponding to the photographing scene,the photographing method further comprises: determining a human face keypoint set from the human body key point set; obtaining a horizontalcoordinate of each human face key point to obtain a plurality of firsthorizontal coordinates; calculating a first average value of theplurality of first horizontal coordinates; and in response to the firstaverage value being within a predetermined range, determining a targetcomposition key point set corresponding to the human face key point setfrom the composition key point set; wherein the human body key point setnot matching the composition key point set comprises: the human face keypoint set not matching the target composition key point set.
 8. Thephotographing method of claim 7, wherein after the step of determiningthe target composition key point set corresponding to the human face keypoint set from the composition key point set, the photographing methodfurther comprises: obtaining a vertical coordinate of each human keypoint to obtain a plurality of first vertical coordinates and obtaininga horizontal coordinate and a vertical coordinate of each targetcomposition key point to obtain a plurality of first verticalcoordinates and a plurality of second horizontal coordinates;calculating a second average value of the plurality of first verticalcoordinates, a third average value of the plurality of first verticalcoordinates and a fourth average value of the plurality of secondhorizontal coordinates; determining a first target coordinate accordingto the first average value and the second average value and determininga second target coordinate according to the third average value and thefourth average value; and calculating a first distance between the firsttarget coordinate and the second target coordinate; wherein the humanbody key point set not matching the composition key point set comprises:the first distance being greater than or equal to a first predetermineddistance.
 9. The photographing method of claim 7, wherein after the stepof calculating the first average value of the plurality of horizontalcoordinates, the photographing method further comprises: in response tothe first average not within the predetermined range, detecting whetherthe human body key point set has a predetermined key point; in responseto the human body key point set not having a predetermined key point,obtaining a first center coordinate of the human body boundary frame anda second center coordinate of the composition boundary framecorresponding to the composition key point set; and calculating a seconddistance between the first center coordinate and the second centercoordinate; wherein the human body key point set not matching thecomposition key point set comprises: the second distance being greaterthan or equal to a second predetermined distance.
 10. The photographingmethod of claim 9, wherein after the step of detecting whether the humanbody key point set has the predetermined key point, the photographingmethod further comprises: in response to the human key point set havingthe predetermined key point, obtaining a first center horizontalcoordinate of the human body boundary frame and a second centerhorizontal coordinate of the composition boundary frame corresponding tothe composition key point set; determining a target composition keypoint set corresponding to the human face key point set from thecomposition key point set; obtaining a vertical coordinate of each humanface key point to obtain a plurality of third vertical coordinates andobtaining a vertical coordinate of each composition key point to obtaina plurality of fourth vertical coordinates; calculating a fifth averagevalue of the plurality of third vertical coordinates and a sixth averagevalue of the plurality of fourth vertical coordinates; determining athird target coordinate according to the first center horizontalcoordinate and the fifth average value and determining a fourth targetcoordinate according to the second center horizontal coordinate and thesixth average value; and calculating a third distance between the thirdtarget coordinate and the fourth target coordinate; wherein the humanbody key point set not matching the composition key point set comprises:the third distance being greater than or equal to a third predetermineddistance.
 11. A non-transitory storage medium, storing computer programexecutable by a computer to perform operations comprising: performing akey point detection on a human body in a photographing scene to obtain ahuman body key point set of the human body; determining a compositionkey point set corresponding to the photographing scene; in response tothe human body key point set not matching the composition key point set,generating and outputting a prompt message to adjust an attitude of anelectronic device; and in response to the human body key point setmatching the composition key point set, performing a photographingoperation on the photographing scene to obtain a target image.
 12. Anelectronic device, comprising: a processor; and a storage device,storing computer program; wherein the processor is configured to executethe computer program stored in the storage device to perform operationscomprising: performing a key point detection on a human body in aphotographing scene to obtain a human body key point set of the humanbody; determining a composition key point set corresponding to thephotographing scene; in response to the human body key point set notmatching the composition key point set, generating and outputting aprompt message to adjust an attitude of the electronic device; and inresponse to the human body key point set matching the composition keypoint set, performing a photographing operation on the photographingscene to obtain a target image.
 13. The electronic device of claim 12,wherein the performing the key point detection on the human body in thephotographing scene to obtain the key point set of the human bodycomprises: obtaining a preview image of the photographing scene;utilizing a portrait detection model to perform a portrait detection onthe preview image to obtain a human body boundary frame; cutting thepreview image based on the human body boundary frame to obtain a humanbody image; and utilizing a key point detection model to perform the keypoint detection on the human body image to obtain the human body keypoint set of the human body.
 14. The electronic device of claim 13,wherein the determining the composition key point set corresponding tothe photographing scene comprises: dividing the preview image into aforeground image and a background image; determining a plurality ofcandidate key point sets corresponding to the background image;determining a human body type of the human body; and determining, fromthe plurality of candidate key point sets, at least one of candidate keypoint sets that is corresponding to the human body type as thecomposition key point set corresponding to the photographing scene. 15.The electronic device of claim 14, wherein the operations furthercomprise: in response to multiple of the candidate key point setscorrespond to the human body type, obtaining a composition boundaryframe according to each of the multiple of candidate key point setscorresponding to the human body type; and determining at least one ofthe multiple of candidate key point sets, where the composition boundaryframe corresponding to the at least one of the multiple of candidate keypoint matches the human body boundary frame, as the composite key pointset corresponding to the photographing scene.
 16. The electronic deviceof claim 12, wherein the operations further comprise: calculatingdistances between each human body key point and its correspondingcomposition key point; calculating an average distance of the distances;and in response to the average distance being greater than or equal to apredetermined average distance, generating and outputting a promptmessage to adjust an attitude of the electronic device.
 17. Theelectronic device of claim 16, wherein the operations further comprise:generating a plurality of candidate vectors; predicting a target humanbody key point set obtained after adjusting the attitude of theelectronic device according to each of the candidate vectors;determining a candidate vector of the plurality of candidate vectors asa target vector, wherein the target human body key point setcorresponding to the candidate vector matches the composition key pointset; and generating and outputting the prompt message to adjust theattitude of the electronic device according to the target vector. 18.The electronic device of claim 12, wherein the operations furthercomprise: determining a human face key point set from the human body keypoint set; obtaining a horizontal coordinate of each human face keypoint to obtain a plurality of first horizontal coordinates; calculatinga first average value of the plurality of first horizontal coordinates;in response to the first average value being within a predeterminedrange, determining a target composition key point set corresponding tothe human face key point set from the composition key point set; and inresponse to the human face key point set not matching the targetcomposition key point set, generating and outputting a prompt message toadjust an attitude of the electronic device.
 19. The electronic deviceof claim 18, wherein the operations further comprise: obtaining avertical coordinate of each human key point to obtain a plurality offirst vertical coordinates and obtaining a horizontal coordinate and avertical coordinate of each target composition key point to obtain aplurality of first vertical coordinates and a plurality of secondhorizontal coordinates; calculating a second average value of theplurality of first vertical coordinates, a third average value of theplurality of first vertical coordinates and a fourth average value ofthe plurality of second horizontal coordinates; determining a firsttarget coordinate according to the first average value and the secondaverage value and determining a second target coordinate according tothe third average value and the fourth average value; calculating afirst distance between the first target coordinate and the second targetcoordinate; and in response to the first distance being greater than orequal to a first predetermined distance, generating and outputting aprompt message to adjust an attitude of the electronic device.
 20. Theelectronic device of claim 18, wherein the operations further comprise:in response to the first average not within the predetermined range,detecting whether the human body key point set has a predetermined keypoint; in response to the human body key point set not having apredetermined key point, obtaining a first center coordinate of thehuman body boundary frame and a second center coordinate of thecomposition boundary frame corresponding to the composition key pointset; calculating a second distance between the first center coordinateand the second center coordinate; and in response to the second distancebeing greater than or equal to a second predetermined distance,generating and outputting a prompt message to adjust an attitude of theelectronic device.